package com.tangchao.client.sdh.view.role
{
	import flash.display.DisplayObject;
	import flash.display.Sprite;
	import flash.text.TextField;
	
	import gs.TweenMax;
	
	public class QiPao extends Sprite
	{
		private var _tips:DisplayObject;
		private var _tfText:TextField;
		private var _mcPic:Sprite;
		
		private const SHOWTIMESEC:int = 3;
		
		static public const YIZHUNBEI:int = 0;
		static public const BUJIAO:int    = 1;
		
		public function QiPao()
		{
			super();
			
			this.mouseEnabled  = false;
			this.mouseChildren = false;
			this.alpha = 0;
			
			_tfText = getChildByName("tfText") as TextField;
			_tfText.text = "";
		}
		
		public function setText(msg:String):void
		{
			if(_mcPic)
			{
				removeChild(_mcPic);
				_mcPic = null;
			}
			
			if(msg)
			{
				_tfText.text = msg;
				doShow();
			}
			else
			{
				_tfText.text = "";
			}
		}
		
		private function doShow():void
		{
			alpha = 1;
			var tweenMax:TweenMax=TweenMax.to(this, SHOWTIMESEC, {alpha:0});
		}
		
		public function setStat(stat:int):void
		{
			_tfText.text = "";
			
			if(_mcPic)
			{
				removeChild(_mcPic);
				_mcPic = null;
			}
			
			switch(stat)
			{
				case YIZHUNBEI:
					_mcPic = new Yizhunbei();
					addChild(_mcPic);
					doShow();
					break;
				case BUJIAO:
					_mcPic = new Bujiao();
					addChild(_mcPic);
					doShow();
					break;
				default:
					break;
			}
		}
	}
}